/**
 * 客户商品
 */
import request from '@/utils/request'

/**
 * 客户商品列表
 * 权限字符串：basic-data:customer-goods:list
 * @param {*} params 
 */
export function customerGoodsList(params = {}) {
  return request({
    url: '/basic/data/tenant/goods/list',
    method: 'get',
    params: params
  })
}

/**
 * 客户商品详情
 * 权限字符串：basic-data:customer-goods:query
 * @param {*} params 
 */
export function customerGoodsDetail(params = {}) {
  return request({
    url: '/basic/data/tenant/goods/getInfo/' + params.id,
    method: 'get',
    params: {}
  })
}

/**
 * 新增客户商品信息
 * 权限字符串：basic-data:customer-goods:add
 * @param {*} params 
 */
export function customerGoodsAdd(params = {}) {
  return request({
    url: '/basic/data/tenant/goods/add',
    method: 'post',
    data: params
  })
}

/**
 * 客户商品信息修改
 * 权限字符串：basic-data:customer-goods:edit
 * @param {*} params 
 * @returns 
 */
export function customerGoodsEdit(params = {}) {
  return request({
    url: '/basic/data/tenant/goods/edit',
    method: 'post',
    data: params
  })
}

/**
 * 查询所属组织和渠道下拉列表
 * @param {*} params 
 */
export function customerGoodsOrgs(params = {}) {
  params = {tenantType:'CUSTOMER',...params}
  return request({
    url: '/basic/data/tenant/goods/getOrganizeInfo',
    method: 'get',
    params: params
  })
}

// 商品导入 权限字符串：basic-data:customer-goods:import
// 导出 权限字符串：basic-data:customer-goods:export

/**
 * 查询商品分类、商品类型下拉列表
 * @param {*} params 
 * @returns 
 */
export function getTypeAndClassInfos(params = {}) {
  return request({
    url: '/basic/data/tenant/goods/getTypeAndClassInfo',
    method: 'get',
    params: params
  })
}

/**
 * 查询仓库列表
 * 权限字符串：basic-data:warehouse:list
 * @param {*} params 
 */
export function warehouseList(params = {}) {
  return request({
    url: '/basic/data/warehouse/list',
    method: 'get',
    params: params
  })
}

/**
 * 查询指定类型下仓库列表
 * 权限字符串:basic-data:warehouse:getByType
 * @param {*} params 
 */
export function warehouseListByType(params = {}) {
  return request({
    url: '/basic/data/warehouse/getByType',
    method: 'get',
    params: params
  })
}

/**
 * 货位列表查询
 * 权限字符串：basic-data:location:list
 * @param {warehouseId} params
 */
export function warehouseLocList(params = {}) {
  return request({
    url: '/basic/data/warehouse/location/list',
    method: 'get',
    params: params
  })
}

/**
 * 查询仓库列表 本级租户的可用仓库
 * @param {*} params 
 */
export function warehouseCurrentLevelList(params = {}) {
  return request({
    url: '/basic/data/warehouse/listForGoods',
    method: 'get',
    params: params
  })
}

/**
 * 商品管理导出--选择数据
 * @param {*} params 
 */
export function tenantGoodsExportById(params = {}) {
  return request({
    url: '/basic/data/tenant/goods/exportById',
    method: 'post',
    data: params,
    responseType: 'blob',
    getResponse: true
  })
}